using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class db_version : MangosBase
	{
		public System.String version;
		public System.String creature_ai_version;
		public System.Int32? cache_id;
		public System.UInt64? required_10219_01_mangos_spell_proc_event;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `db_version` (`version`, `creature_ai_version`, `cache_id`, `required_10219_01_mangos_spell_proc_event`) VALUES ('{0}', '{1}', '{2}', '{3}');", version.MySQLDBString(), creature_ai_version.MySQLDBString(), cache_id.GetValueOrDefault(), required_10219_01_mangos_spell_proc_event.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `db_version` SET ");
			if(creature_ai_version != null)
			{
				sb.AppendLine("`creature_ai_version`='" + creature_ai_version.MySQLDBString() + "'");
			}
			if(cache_id != null)
			{
				sb.AppendLine("`cache_id`='" + cache_id.Value.ToString() + "'");
			}
			if(required_10219_01_mangos_spell_proc_event != null)
			{
				sb.AppendLine("`required_10219_01_mangos_spell_proc_event`='" + required_10219_01_mangos_spell_proc_event.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
                sb.Append(" WHERE `version`='" + version.MySQLDBString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
